package com.cw.jeeyt.dao.impl.system;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.dao.intf.system.SystemHolidayDao;
import com.cw.jeeyt.dao.mapper.system.SystemHolidayMapper;
import com.cw.jeeyt.dao.model.system.SystemHolidayDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * 节假日信息 dao数据库操作接口
 *
 * @author chenw
 * @version 1.0.0
 */
@Repository
public class SystemHolidayDaoImpl implements SystemHolidayDao {
    @Autowired
    private SystemHolidayMapper systemHolidayMapper;

    /**
     * 查询所有节假日信息
     *
     * @return 节假日信息集合
     */
    @Override
    public List<SystemHolidayDo> querySystemHolidayList() {
        return systemHolidayMapper.querySystemHolidayList();
    }

    /**
     * 删除节假日信息
     *
     * @param systemHoliday
     */
    @Override
    public void deleteSystemHoliday(SystemHolidayDo systemHoliday) {
        systemHolidayMapper.deleteSystemHoliday(systemHoliday);
    }

    /**
     * 修改节假日信息
     *
     * @param systemHoliday
     */
    @Override
    public void updateSystemHoliday(SystemHolidayDo systemHoliday) {
        systemHolidayMapper.updateSystemHoliday(systemHoliday);
    }

    /**
     * 根据主键查询节假日信息
     *
     * @param id 主键id
     * @return SystemHoliday
     */
    @Override
    public SystemHolidayDo getSystemHolidayById(String id) {
        return systemHolidayMapper.getSystemHolidayById(id);
    }

    /**
     * 新增节假日信息
     *
     * @param systemHoliday
     * @return 整数
     */
    @Override
    public Integer insertSystemHoliday(SystemHolidayDo systemHoliday) {
        return systemHolidayMapper.insertSystemHoliday(systemHoliday);
    }

    /**
     * 分页查询节假日信息
     *
     * @param systemHoliday 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return SystemHoliday集合
     */
    @Override
    public PageInfo<SystemHolidayDo> queryByPage(SystemHolidayDo systemHoliday, Integer startNum, Integer pageSize) {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(systemHolidayMapper.queryByPage(systemHoliday));
    }
}
